<div class="panel panel-default">
    <div class="panel-body">
        <!-- Nav tabs -->
        <ul class="nav nav-tabs" role="tablist">
            <li role="presentation" class="active"><a href="#base" aria-controls="base" role="tab" data-toggle="tab">基本</a></li>
            <li role="presentation"><a href="#account" aria-controls="account" role="tab" data-toggle="tab">ssh/http</a></li>
            <li role="presentation"><a href="#config" aria-controls="config" role="tab" data-toggle="tab">配置</a></li>
        </ul>
        <br>
        <!-- Tab panes -->
        <div class="tab-content">
            <div role="tabpanel" class="tab-pane active" id="base">
                <div class="table-responsive">
                    <table class="table table-bordered table-hover">
                        <tbody>{{$project := .project}}{{$groupName := .groupName}}
                        <tr>
                            <td class="w20p">项目名</td>
                            <td>{{$project.name}}</td>
                        </tr>
                        <tr>
                            <td class="w20p">项目组</td>
                            <td>{{$groupName}}</td>
                        </tr>
                        <tr>
                            <td class="w20p">创建人</td>
                            <td>{{$project.user_id}}</td>
                        </tr>
                        <tr>
                            <td class="w20p">代码仓库</td>
                            <td>{{$project.repository_url}}</td>
                        </tr>
                        <tr>
                            <td>代码分支</td>
                            <td>
                                <strong>{{$project.branch}}</strong>
                            </td>
                        </tr>
                        <tr>
                            <td>发布目录</td>
                            <td>{{$project.code_path}}</td>
                        </tr>
                        <tr>
                            <td>目录所属用户</td>
                            <td>{{$project.code_dir_user}}</td>
                        </tr>
                        <tr>
                            <td>更新时间</td>
                            <td>{{dateFormat $project.update_time "Y-m-d H:i:s"}}</td>
                        </tr>
                        <tr>
                            <td>上一次发布时间</td>
                            <td>
                                {{if eq $project.last_publish_time "0"}}
                                0
                                {{else}}
                                {{dateFormat $project.last_publish_time "Y-m-d H:i:s"}}
                                {{end}}
                            </td>
                        </tr>
                        <tr>
                            <td>备注</td>
                            <td>{{$project.comment}}</td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
            <div role="tabpanel" class="tab-pane" id="account">
                <div class="table-responsive">
                    <table class="table table-bordered table-hover">
                        <tbody>{{$project := .project}}{{$groupName := .groupName}}
                        <tr>
                            <td class="w20p">http username</td>
                            <td>{{$project.https_username}}</td>
                        </tr>
                        <tr>
                            <td>http password</td>
                            <td>{{$project.https_password}}</td>
                        </tr>
                        <tr>
                            <td>ssh key</td>
                            <td>{{$project.ssh_key}}</td>
                        </tr>
                        <tr>
                            <td>ssh key salt</td>
                            <td>{{$project.ssh_key_salt}}</td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
            <div role="tabpanel" class="tab-pane" id="config">
                <div class="panel panel-default">
                    <div class="panel-heading"><strong>前置命令</strong></div>
                    <table class="table table-bordered table-hover">
                        <tbody>{{$project := .project}}{{$groupName := .groupName}}
                        <tr>
                            <td class="w20p">命令</td>
                            <td>
                                <div class="col-sm-6">
                                    <pre>{{$project.pre_command}}</pre>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td>执行方式</td>
                            <td>
                                {{if eq $project.pre_command_exec_type "1" }} 同步执行，遇到错误停止 {{end}}
                                {{if eq $project.pre_command_exec_type "2" }} 同步执行，遇到错误继续 {{end}}
                                {{if eq $project.pre_command_exec_type "3" }} 异步执行 {{end}}
                            </td>
                        </tr>
                        <tr>
                            <td>超时时间</td>
                            <td>{{$project.pre_command_exec_timeout}}s</td>
                        </tr>
                        </tbody>
                    </table>
                </div>
                <div class="panel panel-default">
                    <div class="panel-heading"><strong>后置命令</strong></div>
                    <table class="table table-bordered table-hover">
                        <tbody>{{$project := .project}}{{$groupName := .groupName}}
                        <tr>
                            <td class="w20p">命令</td>
                            <td>
                                <div class="col-sm-6">
                                    <pre>{{$project.post_command}}</pre>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td>执行方式</td>
                            <td>
                                {{if eq $project.post_command_exec_type "1" }} 同步执行，遇到错误停止 {{end}}
                                {{if eq $project.post_command_exec_type "2" }} 同步执行，遇到错误继续 {{end}}
                                {{if eq $project.post_command_exec_type "3" }} 异步执行 {{end}}
                            </td>
                        </tr>
                        <tr>
                            <td>超时时间</td>
                            <td>{{$project.post_command_exec_timeout}}s</td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
